﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using TSqlServer;

/// <summary>
/// TLinkman 的摘要说明
/// </summary>
public class TLinkman : TData
{
    //常量
    const string CTableName = "t_linkman";
    const string CKeyName = "uid";
    //与数据表字段对应的变量
    private string FUID;
    private string FLinkman;
    private string FImpLevel;
    private string FSrvCompany;
    private string FSex;
    private string FCompanyAbb;
    private string FCompany;
    private string FDept;
    private string FJobPosi;
    private string FUnitType;
    private string FAge;
    private string FBirthday;
    private string FEMail;
    private string FMobile;
    private string FTel;
    private string FFax;
    private string FCompanyAddr;
    private string FCompanyPostcode;
    private string FFavr;
    private string FNotice;
    private int FStatus;
    private string FInMan;
    private DateTime FInTime;
    private int FIId;
    
    public TLinkman()
	{
        FTableName = CTableName;
        FKeyName = CKeyName;
    }

    public TLinkman(string sid)
    {
        FTableName = CTableName;
        FKeyName = CKeyName;
        FKeyValue = sid;
    }

    //根据uid获得记录值
    public override void Select()
    {
        string strSql = GetSelectString();
        TSqlDB oDB = new TSqlDB(strSql);
        if (!oDB.EOF)
        {
            FUID        = oDB["uid"].ToString();
            FLinkman    = oDB["linkman"].ToString();
            FImpLevel   = oDB["implevel"].ToString();
            FSrvCompany = oDB["srvcompany"].ToString();
            FSex        = oDB["sex"].ToString();
            FCompanyAbb = oDB["companyabb"].ToString();
            FCompany    = oDB["company"].ToString();
            FDept       = oDB["dept"].ToString();
            FJobPosi    = oDB["jobposi"].ToString();
            FUnitType   = oDB["unittype"].ToString();
            FAge        = oDB["age"].ToString();
            FBirthday   = oDB["birthday"].ToString();
            FEMail      = oDB["email"].ToString();
            FMobile     = oDB["mobile"].ToString();
            FTel        = oDB["tel"].ToString();
            FFax        = oDB["fax"].ToString();
            FCompanyAddr = oDB["companyaddr"].ToString();
            FCompanyPostcode = oDB["companypostcode"].ToString();
            FFavr       = oDB["favr"].ToString();
            FNotice     = oDB["notice"].ToString();
            FStatus     = oDB["status"].ToInt();
            FInMan      = oDB["inman"].ToString();
            FInTime     = oDB["intime"].ToDateTime();
            FIId        = oDB["iid"].ToInt();
        }
        oDB.Free();
    }

    //插入新记录。
    public void Insert()
    {
        string ExSql = "newid(),'" + FLinkman + "','"+FImpLevel+"','"+FSrvCompany+"','" + FSex + "','" + FCompanyAbb + "','" + FCompany + "','" + FDept + "','" + FJobPosi + "','" + FUnitType + "','" + FAge + "',";
        ExSql += "'" + FBirthday + "','" + FEMail + "','" + FMobile + "','" + FTel + "','" + FFax + "','" + FCompanyAddr + "','" + FCompanyPostcode + "','" + FFavr + "','"+FNotice+"',";
        ExSql += FStatus.ToString() + ",'" + FInMan + "',getdate()";
        base.Insert(ExSql);
    }

    //更新记录。
    public void Update()
    {
        string ExSql = "linkman='" + FLinkman + "',implevel='"+FImpLevel+"',srvcompany='"+FSrvCompany+"',sex='" + FSex + "',companyabb='" + FCompanyAbb + "',company='" + FCompany + "',dept='" + FDept + "',jobposi='"+FJobPosi+"',";
        ExSql += "unittype='" + FUnitType + "',age='" + FAge + "',birthday='" + FBirthday + "',email='" + FEMail + "',mobile='" + FMobile + "',tel='" + FTel + "',fax='" + FFax + "',";
        ExSql += "companyaddr='" + FCompanyAddr + "',companypostcode='" + FCompanyPostcode + "',favr='" + FFavr + "',notice='" + FNotice + "',intime=getdate()";
        base.Update(ExSql);
    }

    //改变状态,0=未验证,1=已通过验证
    public void Update_status()
    {
        string ExSql = "status=" + FStatus.ToString(); ;
        base.Update(ExSql);
    }

    //静态，可以不用创建对象即可调用。
    public static void DeleteByID(string sID)
    {
        TData.DeleteByID(sID, CTableName, CKeyName);
    }

    public string UID
    {
        get
        {
            return FUID;
        }
        set
        {
            FUID = value;
        }
    }

    public string Linkman
    {
        get
        {
            return FLinkman;
        }
        set
        {
            FLinkman = value;
        }
    }

    public string ImpLevel
    {
        get
        {
            return FImpLevel;
        }
        set
        {
            FImpLevel = value;
        }
    }

    public string SrvCompany
    {
        get
        {
            return FSrvCompany;
        }
        set
        {
            FSrvCompany = value;
        }
    }

    public string Sex
    {
        get
        {
            return FSex;
        }
        set
        {
            FSex = value;
        }
    }

    public string CompanyAbb
    {
        get
        {
            return FCompanyAbb;
        }
        set
        {
            FCompanyAbb = value;
        }
    }

    public string Company
    {
        get
        {
            return FCompany;
        }
        set
        {
            FCompany = value;
        }
    }

    public string Dept
    {
        get
        {
            return FDept;
        }
        set
        {
            FDept = value;
        }
    }

    public string JobPosi
    {
        get
        {
            return FJobPosi;
        }
        set
        {
            FJobPosi = value;
        }
    }

    public string UnitType
    {
        get
        {
            return FUnitType;
        }
        set
        {
            FUnitType = value;
        }
    }

    public string Age
    {
        get
        {
            return FAge;
        }
        set
        {
            FAge = value;
        }
    }

    public string Birthday
    {
        get
        {
            return FBirthday;
        }
        set
        {
            FBirthday = value;
        }
    }

    public string EMail
    {
        get
        {
            return FEMail;
        }
        set
        {
            FEMail = value;
        }
    }

    public string Mobile
    {
        get
        {
            return FMobile;
        }
        set
        {
            FMobile = value;
        }
    }

    public string Tel
    {
        get
        {
            return FTel;
        }
        set
        {
            FTel = value;
        }
    }

    public string Fax
    {
        get
        {
            return FFax;
        }
        set
        {
            FFax = value;
        }
    }

    public string CompanyAddr
    {
        get
        {
            return FCompanyAddr;
        }
        set
        {
            FCompanyAddr = value;
        }
    }

    public string CompanyPostcode
    {
        get
        {
            return FCompanyPostcode;
        }
        set
        {
            FCompanyPostcode = value;
        }
    }

    public string Favr
    {
        get
        {
            return FFavr;
        }
        set
        {
            FFavr = value;
        }
    }

    public string Notice
    {
        get
        {
            return FNotice;
        }
        set
        {
            FNotice = value;
        }
    }

    public int Status
    {
        get
        {
            return FStatus;
        }
        set
        {
            FStatus = value;
        }
    }

    public string InMan
    {
        get
        {
            return FInMan;
        }
        set
        {
            FInMan = value;
        }
    }

    public DateTime InTime
    {
        get
        {
            return FInTime;
        }
        set
        {
            FInTime = value;
        }
    }

    public int IId
    {
        get
        {
            return FIId;
        }
        set
        {
            FIId = value;
        }
    }
}
